Skip to content

Conversation

@aaronjeline
Copy link
Contributor

Maps currently don't preserve -0.0. If you add -0.0 as a value in a map, and read it, you will get 0.0.

This isn't true of other structures.

It happens because the default value is 0.0, and when adding a new value, the code checks if it is equal to the default value using PartialEq, which for floats treats 0.0 and -0.0 as equal.

@aaronjeline aaronjeline force-pushed the bugfix/float_defaults branch from 24f98e3 to c6bada9 Compare January 12, 2026 19:36
Adds a new trait `IsDefault`
- Allows overriding equality checking for floats
- Has a default implementation for anything that implements PartialEq
- Derived automatically as part of deriving `prost::Message`
@aaronjeline aaronjeline force-pushed the bugfix/float_defaults branch from c6bada9 to 4443f1f Compare January 12, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants